<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>注册</title>
    <meta name="description" content="电销宝后台管理框架">
    <link href="../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
    <link href="../static/css/login.min.css" th:href="@{/css/login.min.css}" rel="stylesheet"/>
    <link href="../static/ruoyi/css/ry-ui.css" th:href="@{/ruoyi/css/ry-ui.css?v=4.7.0}" rel="stylesheet"/>
    <!-- 360浏览器急速模式 -->
    <meta name="renderer" content="webkit">
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="shortcut icon" href="../static/favicon.ico" th:href="@{favicon.ico}"/>
    <style type="text/css">label.error { position:inherit;  }</style>
</head>
<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1><img alt="[ 电销宝 ]" src="../static/ruoyi.png" th:src="@{/ruoyi.png}" ></h1>
                </div>
                <div class="m-b"></div>
                <h4 align="center">推荐注册 <strong>奖励多多</strong></h4>
            </div>
        </div>
        <div class="col-sm-5">
            <form id="registerForm" autocomplete="off">
                <h4 class="no-margins">注册：</h4>
                <input type="text"     name="phone" class="form-control uname"         placeholder="手机号"   maxlength="20" />
                <button type="button" id="sendMsg"  class="btn btn-mini btn-warning" onclick="sendSms()">获取手机验证码</button>
                <input type="text" name="vCode" class="form-control code"         placeholder="验证码"     maxlength="20" />
                <input type="password" name="password" class="form-control pword"         placeholder="密码"     maxlength="20" />
                <input type="password" name="confirmPassword" class="form-control pword"  placeholder="确认密码" maxlength="20" />
                <p class="m-t-md">推荐码:</p>
                <input type="text" name="inviteCode"  style="color: #00B83F" class="form-control " th:value="*{inviteCode}" maxlength="20" readonly/>
                <p class="m-t-md" style="font-size: 10px">推荐码是推荐人向您发送的邀请码，使用推荐码注册成功的用户的推荐人会有相应的奖励</p>
<!--                <div class="checkbox-custom" th:classappend="${captchaEnabled==false} ? 'm-t'">-->
<!--                    <input type="checkbox" id="acceptTerm" name="acceptTerm"> <label for="acceptTerm">我已阅读并同意</label>-->
<!--                    <a href="https://gitee.com/y_project/RuoYi/blob/master/README.md" target="_blank">使用条款</a>-->
<!--                </div>-->
                <button type="button" class="btn btn-success btn-block" id="btnSubmit" onclick="regUser()" >注册</button>
            </form>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    function sendSms() {
        $.modal.loading("正在发送");
        let phone = $.common.trim($("input[name='phone']").val());
        let data ={};
        data.phone=phone;
        $.ajax({
            type: "get",
            url: ctx + "login/sendMsg?phone="+phone,
            cache: false,
            contentType: "application/json",
            processData: false,  //必须false才会避开jQuery对 formdata 的默认处理
            dataType: 'JSON',
            success: function(result) {
                $.modal.closeLoading();
                $.modal.alertSuccess(result.msg);
            },
            error: function(error) {
                $.modal.closeLoading();
                $.modal.alertWarning("服务器出错，请联系客服");
            }
        });
    }
    function regUser() {
        $.modal.loading("正在注册");
        var phone = $.common.trim($("input[name='phone']").val());
        var vCode = $.common.trim($("input[name='vCode']").val());
        var password = $.common.trim($("input[name='password']").val());
        var inviteCode = $.common.trim($("input[name='inviteCode']").val());
        let data ={};
        data.phone=phone;
        data.vCode=vCode;
        data.passwd=password;
        data.inviteCode=inviteCode;
        $.ajax({
            type: "post",
            url: ctx + "login/inviteRegister",
            cache: false,
            data:JSON.stringify(data),
            contentType: "application/json",
            processData: false,  //必须false才会避开jQuery对 formdata 的默认处理
            dataType: 'JSON',
            success: function(result) {
                if (result.code === web_status.SUCCESS) {
                    $.modal.closeLoading();
                    $.modal.alertSuccess(result.msg);
                    window.location.href = "https://web.llmmwl.com/dxb_download.html";
                } else {
                    $.modal.closeLoading();
                    $.modal.alertError(result.msg);
                }
            },
            error: function(error) {
                $.modal.closeLoading();
                $.modal.alertWarning("服务器出错，请联系客服");
            }
        });
    }
</script>
<!-- 全局js -->
</body>
</html>
